<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>demo练习</title>
    <style>
        .center{
            text-align: center;
            margin-top: 200px;
        }
    </style>
</head>
<body>
<div class="center">
    您好，支付完成，<span id="time">5</span>秒后将自动跳转到<a href="https://www.baidu.com">百度</a> ！
</div>
</body>
<script>
    let time = document.querySelector("#time");
    count = time.innerHTML;
    let timer = setInterval(function () {
        count--;
        if (count > 0){
            time.innerHTML = count;
        }else {
            clearInterval(timer);
            window.location.href = "https://www.baidu.com";
        }
    }, 1000);
</script>
</html>